//
//  ClubModel.m
//  TasteEnjoy
//
//  Created by XuRui on 16/4/26.
//  Copyright © 2016年 XuRui. All rights reserved.
//

#import "ClubModel.h"

@implementation ClubModel


- (void)dealloc
{
    [_selfID release];
    [_content release];
    
    [_senderID release];
    [_username release];
    [_avatar release];
    
    [_path release];
    [_width release];
    [_height release];
    
    [_tagID release];
    [_tagName release];
    [_tagrelation_type release];
    
    [_comment_count release];
    [_active_time release];
    [_add_datetime_ts release];
    
    [_clubID release];
    [_clubname release];
    
    [_visit_count release];
    [_like_count release];
    [_reply_count release];
    [super dealloc];
    
}


#pragma mark - ------------ 当找不到 key 时 ---------------
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{

    
    if ([key isEqualToString:@"id"]) {
        self.selfID = value;
    }
    
    if ([key isEqualToString:@"sender"]) {
        
        self.username = value[@"username"];
        self.avatar = value[@"avatar"];
    }

    if ([key isEqualToString:@"photos"]) {
        
        for (NSDictionary *dic in value) {
            
            self.width = dic[@"width"];
            self.height = dic[@"height"];
            self.path = dic[@"path"];
        }
    }
    
    if ([key isEqualToString:@"tags"]) {
        for (NSDictionary *dic in value) {
            self.tagID = dic[@"id"];
            self.tagName = dic[@"name"];
            self.tagrelation_type = dic[@"relation_type"];
        }
    }
    
    
    if ([key isEqualToString:@"club"]) {
        self.clubID = value[@"id"];
        self.clubname = value[@"name"];
        
    }
    
    
    //评论数据 
    if ([key isEqualToString:@"replies"]) {
        for (NSDictionary *dic in value) {
            
            self.replyID = dic[@"id"];
            self.replayContent = dic[@"content"];
            self.replyT_comment_id = dic[@"t_comment_id"];
            self.replyAdd_datetime_ts = dic[@"add_datetime_ts"];
            self.replySenderID = dic[@"sender"][@"id"];
            self.replayUsername = dic[@"sender"][@"username"];
            self.replayAvatar = dic[@"sender"][@"avatar"];
        }
        
    }
    
    
}

@end
